package com.yugao.fintech.antelope.auth.model.rqrs.client;

import com.yugao.fintech.antelope.base.model.module.dict.CusFieldBind;
import com.yugao.fintech.antelope.base.model.module.dict.DictTypeCons;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.*;

import java.io.Serializable;
import java.util.Date;
import java.util.List;

/**
 * oauth客户端
 */
@Getter
@Setter
@AllArgsConstructor
@NoArgsConstructor
@Builder
@ApiModel(value = "oauth客户端")
public class OAuthClientResp implements Serializable {
    private Long id;

    @ApiModelProperty(value = "客户端名称")
    private String name;

    @ApiModelProperty(value = "客户端ID")
    private String clientId;

    @ApiModelProperty(value = "资源列表")
    private String resourceIds;

    @ApiModelProperty(value = "客户端密钥")
    private String clientSecret;

    @ApiModelProperty(value = "域")
    private String scope;

    @ApiModelProperty(value = "认证类型")
    @CusFieldBind(
            type = DictTypeCons.AUTHORIZED_GRANT_TYPES, delimiter = ",",
            target = "authorizedGrantTypesText", targetDelimiter = " | ")
    private String authorizedGrantTypes;

    private String authorizedGrantTypesText;

    @ApiModelProperty(value = "扩展的认证类型")
    private String extGrantTypes;

    @ApiModelProperty(value = "重定向地址")
    private String webServerRedirectUri;

    @ApiModelProperty(value = "角色列表")
    private String authorities;

    @ApiModelProperty(value = "token 有效期")
    private Integer accessTokenValidity;

    @ApiModelProperty(value = "刷新令牌有效期")
    private Integer refreshTokenValidity;

    @ApiModelProperty(value = "令牌扩展字段JSON")
    private String additionalInformation;

    @ApiModelProperty(value = "是否自动放行")
    private String autoApprove;

    @ApiModelProperty(value = "创建时间")
    private Date createdAt;

    @ApiModelProperty(value = "更新时间")
    private Date updatedAt;

    @ApiModelProperty(value = "创建人")
    private String createdBy;

    @ApiModelProperty(value = "更新人")
    private String updatedBy;

    /**
     * 是否允许同时在线
     *
     * @see cn.hutool.core.util.BooleanUtil#toBooleanObject(String)
     */
    private String canSameTimeOnline;

    /**
     * 是否使用验证码
     *
     * @see cn.hutool.core.util.BooleanUtil#toBooleanObject(String)
     */
    private String useCaptcha;

    /**
     * 登录失败次数, 当登录失败达到一定次数之后, 就会被锁定 <br/>
     * -1则不限制
     */
    private Integer loginFailCount;

    /**
     * 锁定间隔(单位为秒)
     */
    private Integer lockInterval;

    /**
     * 连续被锁定时间乘子, 下一次锁定的时间 = 连续被锁定次数 * 锁定间隔 * 锁定时间乘子
     */
    private Integer lockMultiplier;

    private String remark;

    /**
     * 角色ids
     */
    private List<Long> roleIds;

    private String appType;
}
